//: innerclasses/GreenhouseController.java
// Configure and execute the greenhouse system.
// {Args: 5000}
package tijava.innerclasses;

import java.util.ArrayList;

import tijava.innerclasses.controller.Event;

public class GreenhouseController {
	public static void main(String[] args) throws InterruptedException {
		final GreenhouseControls gc = new GreenhouseControls();
		gc.new Restart(2000, new ArrayList<Event>() {
			{
				this.add(gc.new ThermostatNight(0));
				this.add(gc.new LightOn(200));
				this.add(gc.new LightOff(400));
				this.add(gc.new WaterOn(600));
				this.add(gc.new WaterOff(800));
				this.add(gc.new Bell(900));
				this.add(gc.new ThermostatDay(1400));
			}
		});
		if (args.length == 1)
			gc.addEvent(new GreenhouseControls.Terminate(new Integer(args[0])));
		gc.run();		
	}
}

